package com.explorati.design_pattern.creational.singleton.example;

public class NumThread extends Thread{

	@Override
	public void run() {
//		GlobalNum globalNum = GlobalNum.getInstance();
//		EnumInstance globalNum = EnumInstance.getInstance();
		ThreadLocalInstance globalNum = ThreadLocalInstance.getInstance();
		
		for(int i = 0; i < 5; i++){
			System.out.println(Thread.currentThread().getName() + "第" + globalNum.getNum() + "次访问!");
			try {
				this.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
}
